package session

import (
	"babyplan/service/jwt"
	"cftgo/cftc"
)

type SessionMgr struct {
	sessionIdHash cftc.ConcurrentMap[string, Session]
	tokenHash     cftc.ConcurrentMap[string, Session]
}

var _instance = new(SessionMgr)

func Instance() *SessionMgr {
	return _instance
}

func (this *SessionMgr) GetSessionBySessionId(sessionId string) *Session {
	session, _ := this.sessionIdHash.Load(sessionId)
	return session
}

func (this *SessionMgr) GetSessionByToken(token string) *Session {
	session, _ := this.tokenHash.Load(token)
	return session
}

func (this *SessionMgr) CreateSession(token string, claims *jwt.Claims) *Session {
	return nil
}
